/**
 * Copyright (c) 2024 Hunan OpenValley Digital Industry Development Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef OHOS_GPUIMAGETRANSFORMFILTER_H
#define OHOS_GPUIMAGETRANSFORMFILTER_H
#include "GPUImageFilter.h"

class GPUImageTransformFilter : public GPUImageFilter {
public:
    static const std::string TRANSFORM_VERTEX_SHADER;
    GPUImageTransformFilter();
    ~GPUImageTransformFilter();
    void onInit();
    void onInitialized();
    void onOutputSizeChanged(int width, int height);
    void onDraw(int textureId, float *cubeBuffer, float *textureBuffer);
    void setTransform3D(float *transform3DArr);
    float *getTransform3D();
    void setIgnoreAspectRatio(bool ignoreAspectRatioVal);
    bool getIgnoreAspectRatio();
    void setAnchorTopLeft(bool anchorTopLeftVal);
    bool getAnchorTopLeft();

private:
    int transformMatrixUniform;
    int orthographicMatrixUniform;
    float *orthographicMatrix = nullptr;
    float *transform3D = nullptr;
    // This applies the transform to the raw frame data if set to YES,
    // the default of NO takes the aspect ratio of the
    // image input into account when rotating
    bool ignoreAspectRatio;
    // sets the anchor point to top left corner
    bool anchorTopLeft;
};
#endif // OHOS_GPUIMAGETRANSFORMFILTER_H
